﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PSU.Models
{
    public class RepositorioAmigo
    {
        private psuDBDataContext db = new psuDBDataContext();

        public IQueryable<Amigo> FindAll()
        {
            return db.Amigos;
        }

        public Amigo Get(int id1, int id2)
        {
            return db.Amigos.SingleOrDefault(d=>(d.IdPersona1==id1 && d.IdPersona2==id2));
        }

        public void Add(Amigo ob)
        {
            db.Amigos.InsertOnSubmit(ob);
        }

        public void Delete(Amigo ob)
        {
            db.Amigos.DeleteOnSubmit(ob);
        }

        public void Save()
        {
            db.SubmitChanges();
        }
    }
}